﻿angular.module('Caltech').directive('hasAccess', function (Constants, UserAreas) {
    'use strict';

    return {
        restrict: 'A',
        link: function (scope, element, attrs) {
            if ((UserAreas.indexOf(attrs['hasAccess'])) < 0) {
                element.remove();
            }
        }
    }
});

angular.module('Caltech').directive('hasRole', function (Constants, CurrentRole) {
    'use strict';

    return {
        restrict: 'A',
        link: function (scope, element, attrs) {
            if ((attrs['hasRole'].indexOf(CurrentRole)) < 0) {
                element.remove();
            }
        }
    }
});

